<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>水平垂直居中2.1</title>
		<style type="text/css">
			.wrap{
				width:400px;
				height:400px;
				background-color: lightgreen;
				position: relative;
			}
			.item{
				width: 200px;
				height:200px;
				background-color: pink;
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%,-50%);
			}
		</style>
	</head>
	<body>
		<div class="wrap">
			<div class="item"></div>
		</div>
	</body>
</html>
